<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
?><link rel="stylesheet" href="/static/css/item.css">
<div class="banner">
	<div class="container">
		<a href="">怎样发起众筹项目？</a>
		<span class="plus">+</span>
		<a href="">快速了解项目规范</a>
		<i class="fa fa-btc"></i>
	</div>
</div>
<div class="item-box">
	<div class="container">
		<div id="step1" class="support-step1">
			<p>币种：<strong><?php echo $coin['en_name'];?></strong></p>
			<p>可用余额：<strong><?php echo $balance;?></strong></p>
			<p><input type="text" id="amount" placeholder="投资数量"></p>
			<p>可获得：<strong><span id="myget">0</span> <?php echo $db_name;?></strong></p>
			<script>
			$(function(){
				$('#amount').bind('change keyup',function(){
					var amount = $(this).val();
					var rate = Number(<?php echo $db_rate;?>);
					if(rate > 0)
						var myget = amount / rate;
					else
						var myget = 0;
					
					$('#myget,#myget1').text(myget);
					$('[name="amount"]').val(amount);
					$('[name="repay"]').val(myget);
				});
			});
			</script>
			<div class="support-info">
				<ul>
					<li>不限投资数量</li>
					<li>不限投资人数</li>
					<li>已参与<?php echo $support;?>人次</li>
					<li>回报时间：预计项目成功结束后<?php echo $repay_day;?>天内</li>
				</ul>
			</div>
			<button type="button" id="next">下一步</button>
		</div>
		<div id="step2" class="support-step2" style="display:none;">
		<form action="<?php echo site_url('support/insert');?>" method="post" id="form_id">
			<input type="hidden" name="item_id" value="<?php echo $id;?>">
			<input type="hidden" name="coin_id" value="<?php echo $coin['id'];?>">
			<input type="hidden" name="amount">
			<input type="hidden" name="repay">
			<h3>支持金额</h3>
			<ul>
				<li>投资金额：<strong id="amount_view">0</strong> <?php echo $coin['en_name'];?></li>
				<li>支付方式：<strong><?php echo $coin['cn_name'];?></strong></li>
				<li>回报数量：<strong id="myget1">0</strong> <?php echo $db_coin['en_name'];?></li>
			</ul>
			
			<h3>个人信息</h3>
			<ul>
				<li>用户名：<strong><?php echo $user['username'];?></strong></li>
				<li>邮箱：<strong><?php echo $user['email'];?></strong></li>
				<li>认证信息：<strong><?php echo $user['name'];?> <?php echo $user['idno'];?></strong></li>
				<li>手机号码：<strong><?php echo $user['mobile'];?></strong></li>
				<li>性别：<strong>
<?php
if ($user['sex'] == 0) {
?>男<?php
}
else {
?>女<?php
}

?></strong></li>
			</ul>
			
			<p>安全密码：<input type="password" name="paypwd"></p>
			<div class="warning"></div>
			<button type="submit">确定提交</button>
		</form>
		</div>
		
		<script type="text/javascript">
		$(function(){
			$('#next').click(function(){
				var amount = $('#amount').val();

				if(!amount){
					alert('请输入投资数量');
					return false;
				}
				
				$('[name="amount"]').val(amount);
				$('#amount_view').text(amount);

				$('#step1').hide();
				$('#step2').show();
			});

			$('#form_id').checkForm();
		});
		</script>
	</div>
</div>